# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks
pkgname=sonnet
pkgver=6.1.0
pkgrel=0
pkgdesc="Spelling framework for Qt"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://community.kde.org/Frameworks"
license="LGPL-2.1-only"
depends="hunspell"
depends_dev="
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	hunspell-dev
	qt6-qttools-dev
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/frameworks/sonnet.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/sonnet-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	# sonnet-test_autodetect fails to detect a speller backend
	xvfb-run ctest --test-dir build --output-on-failure -E "sonnet-test_autodetect"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
af609e0f978d287073c5ca338ddb221fb8fc3c27a5165bda5f639a3f532f0d02672575287f71be368e0399beac99dc8bdb8f8977df69072e58d8c5f040458635  sonnet-6.1.0.tar.xz
"
